package ch.ethz.fcl.metrobuzz.algorithm.network.shortest_path.public_transport;

import ch.ethz.fcl.metrobuzz.data.MBData;
import ch.ethz.fcl.metrobuzz.spatialindex.object2d.Point2D;

public class SGMRT {
	// fast MRT (EW, NE, CC) speed 40 km/h
	public static final float FAST_SPEED = 40 / 3.6f;
	// slow MRT (NS) speed 30 km/h
	public static final float SLOW_SPEED = 40 / 3.6f;
	// assume real distance is two times the Euclidean distance
	private static final int REAL_DISTANCE_RATIO = 2;

	/**
	 * @param data
	 * @param p1
	 * @param p2
	 * @return time cost (in seconds) to walk between two points on the screen
	 */
	public static float mrtCost(MBData data, String mrtID, Point2D p1, Point2D p2) {
		// assume real distance is
		float distance = data.getScene().getBound().getWorldDist(p1, p2)
				* REAL_DISTANCE_RATIO;
		
		float speed = FAST_SPEED;
		if(mrtID.startsWith("NS"))
			speed = SLOW_SPEED;
		return distance / speed;
	}
}
